/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author plebani
 */
@Entity
@Table(name = "annotation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Annotation.findAll", query = "SELECT a FROM Annotation a"),
    @NamedQuery(name = "Annotation.findById", query = "SELECT a FROM Annotation a WHERE a.id = :id")})
public class Annotation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private String id;
    @Lob
    @Column(name = "Description")
    private String description;
    @Lob
    @Column(name = "XMLAnnotation")
    private String xMLAnnotation;
    @JoinColumn(name = "Id_VirtualMachineConf", referencedColumnName = "ID")
    @ManyToOne
    private VirtualMachineConf idVirtualMachineConf;
    @JoinColumn(name = "Id_DataFile", referencedColumnName = "ID")
    @ManyToOne
    private DataFile idDataFile;
    @JoinColumn(name = "Id_Component", referencedColumnName = "ID")
    @ManyToOne
    private Component idComponent;

    public Annotation() {
    }

    public Annotation(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getXMLAnnotation() {
        return xMLAnnotation;
    }

    public void setXMLAnnotation(String xMLAnnotation) {
        this.xMLAnnotation = xMLAnnotation;
    }

    public VirtualMachineConf getIdVirtualMachineConf() {
        return idVirtualMachineConf;
    }

    public void setIdVirtualMachineConf(VirtualMachineConf idVirtualMachineConf) {
        this.idVirtualMachineConf = idVirtualMachineConf;
    }

    public DataFile getIdDataFile() {
        return idDataFile;
    }

    public void setIdDataFile(DataFile idDataFile) {
        this.idDataFile = idDataFile;
    }

    public Component getIdComponent() {
        return idComponent;
    }

    public void setIdComponent(Component idComponent) {
        this.idComponent = idComponent;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Annotation)) {
            return false;
        }
        Annotation other = (Annotation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.Annotation[ id=" + id + " ]";
    }
    
}
